From: James Preiss <japreiss@usc.edu>
Date: Sun, 10 Jun 2018 05:00:25 +0000 (-0700)
Subject: qanglebetween
X-Git-Url: https://git.owens.tech/assets/lich_lifts_title_slice.png%20%22Lich%20Lifts%22/assets/lich_lifts_title_slice.png%20%22Lich%20Lifts%22/git?a=commitdiff_plain;h=95f08d6db7d9b3ee54225e585ea04ac4b14db7e2;p=forks%2Fcmath3d.git

qanglebetween
---

diff --git a/math3d.h b/math3d.h
index 6540b63..af937a9 100644
--- a/math3d.h
+++ b/math3d.h
@@ -422,6 +422,7 @@ static inline bool misnan(struct mat33 m) {
 	}
 	return false;
 }
+
 // set a 3x3 block within a big row-major matrix.
 // block: pointer to the upper-left element of the block in the big matrix.
 // stride: the number of columns in the big matrix.
@@ -598,6 +599,9 @@ static inline struct quat qneg(struct quat q) {
 static inline float qdot(struct quat a, struct quat b) {
 	return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
 }
+static inline float qanglebetween(struct quat a, struct quat b) {
+	return acosf(qdot(a, b));
+}
 // normalize a quaternion.
 // typically used to mitigate precision errors.
 static inline struct quat qnormalize(struct quat q) {